<script setup>
import { Search } from '@element-plus/icons-vue'
import { ref } from 'vue'
import { useRouter } from 'vue-router'
import { useUserStore } from '@/stores/user';

const router = useRouter()
const input4 = ref('')

const clearLogin =async()=>{
    await useUserStore().exitLogin()
    router.push('/login')
}
</script>

<template>
    <div class="Header">
        <h2 class="logo"><img src="@/assets/images/logo.svg" alt="">微链智达</h2>
        <div class="right">
            <el-input v-model="input4" style="width: 240px" placeholder="搜索">
                <template #prefix>
                    <el-icon class="el-input__icon">
                        <Search />
                    </el-icon>
                </template>
            </el-input>
            <el-dropdown class="avatar" trigger="click">
                <el-avatar src="https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png" class="Avatar"
                    alt="">user</el-avatar>
                <template #dropdown>
                    <el-dropdown-menu>
                        <el-dropdown-item @click="clearLogin()">退出登录</el-dropdown-item>
                    </el-dropdown-menu>
                </template>
            </el-dropdown>
        </div>
    </div>
</template>

<style lang="scss" scoped>
.Header{
    background-color: rgb(59, 66, 107);;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 48px;
    .logo{
        padding-left: 20px;
        display: flex;
        align-items: center;
        img{
            width: 30px;
            padding-right: 10px;
        }
        font-size: 20px;
        color: #fff;
        letter-spacing: 3px;
    }
    .right{
        display: flex;
        align-items: center;
        .Avatar{
            margin: 0 30px;
            cursor: pointer;
        }
    }
}
</style>
